package top.ezzz.rpc.protobuf;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 * <pre>
 * 定义服务（用于gRPC）
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.46.0)",
    comments = "Source: lemon.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class AddressBookServiceGrpc {

  private AddressBookServiceGrpc() {}

  public static final String SERVICE_NAME = "top.ezzz.rpc.AddressBookService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest,
      top.ezzz.rpc.protobuf.PersonProto.AddressBook> getGetAddressBookMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "GetAddressBook",
      requestType = top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest.class,
      responseType = top.ezzz.rpc.protobuf.PersonProto.AddressBook.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest,
      top.ezzz.rpc.protobuf.PersonProto.AddressBook> getGetAddressBookMethod() {
    io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest, top.ezzz.rpc.protobuf.PersonProto.AddressBook> getGetAddressBookMethod;
    if ((getGetAddressBookMethod = AddressBookServiceGrpc.getGetAddressBookMethod) == null) {
      synchronized (AddressBookServiceGrpc.class) {
        if ((getGetAddressBookMethod = AddressBookServiceGrpc.getGetAddressBookMethod) == null) {
          AddressBookServiceGrpc.getGetAddressBookMethod = getGetAddressBookMethod =
              io.grpc.MethodDescriptor.<top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest, top.ezzz.rpc.protobuf.PersonProto.AddressBook>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetAddressBook"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  top.ezzz.rpc.protobuf.PersonProto.AddressBook.getDefaultInstance()))
              .setSchemaDescriptor(new AddressBookServiceMethodDescriptorSupplier("GetAddressBook"))
              .build();
        }
      }
    }
    return getGetAddressBookMethod;
  }

  private static volatile io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.Person,
      top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse> getAddPeopleMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "AddPeople",
      requestType = top.ezzz.rpc.protobuf.PersonProto.Person.class,
      responseType = top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
  public static io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.Person,
      top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse> getAddPeopleMethod() {
    io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.Person, top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse> getAddPeopleMethod;
    if ((getAddPeopleMethod = AddressBookServiceGrpc.getAddPeopleMethod) == null) {
      synchronized (AddressBookServiceGrpc.class) {
        if ((getAddPeopleMethod = AddressBookServiceGrpc.getAddPeopleMethod) == null) {
          AddressBookServiceGrpc.getAddPeopleMethod = getAddPeopleMethod =
              io.grpc.MethodDescriptor.<top.ezzz.rpc.protobuf.PersonProto.Person, top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AddPeople"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  top.ezzz.rpc.protobuf.PersonProto.Person.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse.getDefaultInstance()))
              .setSchemaDescriptor(new AddressBookServiceMethodDescriptorSupplier("AddPeople"))
              .build();
        }
      }
    }
    return getAddPeopleMethod;
  }

  private static volatile io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.AddressBook,
      top.ezzz.rpc.protobuf.PersonProto.AddressBook> getSyncAddressBookMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "SyncAddressBook",
      requestType = top.ezzz.rpc.protobuf.PersonProto.AddressBook.class,
      responseType = top.ezzz.rpc.protobuf.PersonProto.AddressBook.class,
      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
  public static io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.AddressBook,
      top.ezzz.rpc.protobuf.PersonProto.AddressBook> getSyncAddressBookMethod() {
    io.grpc.MethodDescriptor<top.ezzz.rpc.protobuf.PersonProto.AddressBook, top.ezzz.rpc.protobuf.PersonProto.AddressBook> getSyncAddressBookMethod;
    if ((getSyncAddressBookMethod = AddressBookServiceGrpc.getSyncAddressBookMethod) == null) {
      synchronized (AddressBookServiceGrpc.class) {
        if ((getSyncAddressBookMethod = AddressBookServiceGrpc.getSyncAddressBookMethod) == null) {
          AddressBookServiceGrpc.getSyncAddressBookMethod = getSyncAddressBookMethod =
              io.grpc.MethodDescriptor.<top.ezzz.rpc.protobuf.PersonProto.AddressBook, top.ezzz.rpc.protobuf.PersonProto.AddressBook>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SyncAddressBook"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  top.ezzz.rpc.protobuf.PersonProto.AddressBook.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  top.ezzz.rpc.protobuf.PersonProto.AddressBook.getDefaultInstance()))
              .setSchemaDescriptor(new AddressBookServiceMethodDescriptorSupplier("SyncAddressBook"))
              .build();
        }
      }
    }
    return getSyncAddressBookMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static AddressBookServiceStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<AddressBookServiceStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<AddressBookServiceStub>() {
        @java.lang.Override
        public AddressBookServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new AddressBookServiceStub(channel, callOptions);
        }
      };
    return AddressBookServiceStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static AddressBookServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<AddressBookServiceBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<AddressBookServiceBlockingStub>() {
        @java.lang.Override
        public AddressBookServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new AddressBookServiceBlockingStub(channel, callOptions);
        }
      };
    return AddressBookServiceBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static AddressBookServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<AddressBookServiceFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<AddressBookServiceFutureStub>() {
        @java.lang.Override
        public AddressBookServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new AddressBookServiceFutureStub(channel, callOptions);
        }
      };
    return AddressBookServiceFutureStub.newStub(factory, channel);
  }

  /**
   * <pre>
   * 定义服务（用于gRPC）
   * </pre>
   */
  public static abstract class AddressBookServiceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * 一元RPC方法：获取地址簿
     * </pre>
     */
    public void getAddressBook(top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest request,
        io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook> responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetAddressBookMethod(), responseObserver);
    }

    /**
     * <pre>
     * 客户端流式RPC方法：添加多个联系人
     * </pre>
     */
    public io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.Person> addPeople(
        io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse> responseObserver) {
      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getAddPeopleMethod(), responseObserver);
    }

    /**
     * <pre>
     * 双向流式RPC方法：实时同步地址簿
     * </pre>
     */
    public io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook> syncAddressBook(
        io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook> responseObserver) {
      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getSyncAddressBookMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getGetAddressBookMethod(),
            io.grpc.stub.ServerCalls.asyncUnaryCall(
              new MethodHandlers<
                top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest,
                top.ezzz.rpc.protobuf.PersonProto.AddressBook>(
                  this, METHODID_GET_ADDRESS_BOOK)))
          .addMethod(
            getAddPeopleMethod(),
            io.grpc.stub.ServerCalls.asyncClientStreamingCall(
              new MethodHandlers<
                top.ezzz.rpc.protobuf.PersonProto.Person,
                top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse>(
                  this, METHODID_ADD_PEOPLE)))
          .addMethod(
            getSyncAddressBookMethod(),
            io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
              new MethodHandlers<
                top.ezzz.rpc.protobuf.PersonProto.AddressBook,
                top.ezzz.rpc.protobuf.PersonProto.AddressBook>(
                  this, METHODID_SYNC_ADDRESS_BOOK)))
          .build();
    }
  }

  /**
   * <pre>
   * 定义服务（用于gRPC）
   * </pre>
   */
  public static final class AddressBookServiceStub extends io.grpc.stub.AbstractAsyncStub<AddressBookServiceStub> {
    private AddressBookServiceStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected AddressBookServiceStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new AddressBookServiceStub(channel, callOptions);
    }

    /**
     * <pre>
     * 一元RPC方法：获取地址簿
     * </pre>
     */
    public void getAddressBook(top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest request,
        io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook> responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getGetAddressBookMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * 客户端流式RPC方法：添加多个联系人
     * </pre>
     */
    public io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.Person> addPeople(
        io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse> responseObserver) {
      return io.grpc.stub.ClientCalls.asyncClientStreamingCall(
          getChannel().newCall(getAddPeopleMethod(), getCallOptions()), responseObserver);
    }

    /**
     * <pre>
     * 双向流式RPC方法：实时同步地址簿
     * </pre>
     */
    public io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook> syncAddressBook(
        io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook> responseObserver) {
      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
          getChannel().newCall(getSyncAddressBookMethod(), getCallOptions()), responseObserver);
    }
  }

  /**
   * <pre>
   * 定义服务（用于gRPC）
   * </pre>
   */
  public static final class AddressBookServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<AddressBookServiceBlockingStub> {
    private AddressBookServiceBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected AddressBookServiceBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new AddressBookServiceBlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     * 一元RPC方法：获取地址簿
     * </pre>
     */
    public top.ezzz.rpc.protobuf.PersonProto.AddressBook getAddressBook(top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getGetAddressBookMethod(), getCallOptions(), request);
    }
  }

  /**
   * <pre>
   * 定义服务（用于gRPC）
   * </pre>
   */
  public static final class AddressBookServiceFutureStub extends io.grpc.stub.AbstractFutureStub<AddressBookServiceFutureStub> {
    private AddressBookServiceFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected AddressBookServiceFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new AddressBookServiceFutureStub(channel, callOptions);
    }

    /**
     * <pre>
     * 一元RPC方法：获取地址簿
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<top.ezzz.rpc.protobuf.PersonProto.AddressBook> getAddressBook(
        top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getGetAddressBookMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_GET_ADDRESS_BOOK = 0;
  private static final int METHODID_ADD_PEOPLE = 1;
  private static final int METHODID_SYNC_ADDRESS_BOOK = 2;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final AddressBookServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(AddressBookServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_GET_ADDRESS_BOOK:
          serviceImpl.getAddressBook((top.ezzz.rpc.protobuf.PersonProto.GetAddressBookRequest) request,
              (io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_ADD_PEOPLE:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.addPeople(
              (io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddPeopleResponse>) responseObserver);
        case METHODID_SYNC_ADDRESS_BOOK:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.syncAddressBook(
              (io.grpc.stub.StreamObserver<top.ezzz.rpc.protobuf.PersonProto.AddressBook>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class AddressBookServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    AddressBookServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return top.ezzz.rpc.protobuf.PersonProto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("AddressBookService");
    }
  }

  private static final class AddressBookServiceFileDescriptorSupplier
      extends AddressBookServiceBaseDescriptorSupplier {
    AddressBookServiceFileDescriptorSupplier() {}
  }

  private static final class AddressBookServiceMethodDescriptorSupplier
      extends AddressBookServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    AddressBookServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (AddressBookServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new AddressBookServiceFileDescriptorSupplier())
              .addMethod(getGetAddressBookMethod())
              .addMethod(getAddPeopleMethod())
              .addMethod(getSyncAddressBookMethod())
              .build();
        }
      }
    }
    return result;
  }
}
